/**
 * Author: w景洋.
 * Time: 2016/7/6 0006
 */
angular.module('ad_service.making', [])

    .config(['$stateProvider','$urlRouterProvider',
        function($stateProvider, $urlRouterProvider) {
            $stateProvider

                .state('model.menu.making', {
                    url: '/making',
                    templateUrl: service_templateprefix+"ad_service/making.html",
                    controller: 'MakingController'
                })
                .state('model.buy', {//购买设计
                    url : '/buy?bId',
                    templateUrl : service_templateprefix+"ad_service/content_buy.html",
                    controller : 'BuyController'
                })

        }])

    .controller('MakingController', ['$scope', '$state','adService', function($scope,$state,adService) {

        adService.getServiceItem(3).$promise.then(function(data){
            console.log("12")
            console.log("data"+data)
            $scope.seritem = data;
        })
    }])
    .controller('BuyController', ['$scope', '$state','$stateParams','adService', function($scope,$state,$stateParams,adService) {
        adService.getBuyList($stateParams.bId).$promise.then(function(data){
            $scope.buy_list = data;
            var imgstr = $scope.buy_list.images;
            $scope.buy_list.imglist = [];
            $scope.buy_list.imglist = imgstr.split(",");//获取图片List;
        });
        $scope.hidebot = function(){
            //$(".model_bot").hide();
            $state.go('model.pay',{pId:$scope.buy_list.serviceitemid});
        }
    }])